<template>
    <div>
        <div class="tableHead">
            <el-button size="small" :disabled="searchInput === ''">返回申诉列表</el-button>
            <el-row>
                <el-col>
                    <el-input size="small" v-model="searchInput" placeholder="请输入搜索内容" style="width:250px"></el-input>
                    <el-button size="small" type="success" icon="el-icon-search" @click="searchAppeal"></el-button>
                </el-col>
            </el-row>
        </div>
        <el-table :data="tableData" height="500">
            <el-table-column type="selection"></el-table-column>
            <el-table-column prop="shopId" label="店铺ID"></el-table-column>
            <el-table-column prop="shopName" label="店铺名称"></el-table-column>
            <el-table-column prop="userNickname" label="经营者名称"></el-table-column>
            <el-table-column prop="time" label="申诉时间"></el-table-column>
            <el-table-column prop="appeal" label="申诉内容"></el-table-column>
            <el-table-column prop="email" label="邮箱"></el-table-column>
            <el-table-column label="操作" width="200px">
                <template slot-scope="scope">
                    <el-button type="success" size="small" @click="allowAppeal(scope.$index, scope.row)">允许</el-button>
                    <el-button type="danger" size="small" @click="refuseAppeal(scope.$index, scope.row)">驳回</el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination
            background
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="pageStart"
            :page-size="[10, 20, 30]"
            :page-sizes="pageSize"
            layout="sizes, prev, pager, next"
            :total="total"
        ></el-pagination>
    </div>
</template>

<script>
import cookie from '../../cookie/index'
export default{
   data() {
       return {
           tableData:[],
           searchInput:'',
           pageStart:1,
           pageSize:10,
           total:0
       }
   },
   created(){
       this.getAppealList()
   },
   methods:{
       getAppealList(){
           this.$http({
               url:'/shops/admin/selectAppeal',
               method:'POST',
               params:{
                   page:this.pageStart,
                   size:this.pageSize
               },
               headers:{
                   'Authorization': cookie.getToken()
               }
           }).then(data => {
               console.log(data);
               this.tableData = data.data.data.date
               this.total = data.data.data.total
           }).catch(err => {
               console.log(err);
           })
       },
       handleSizeChange(){

       },
       handleCurrentChange(){

       },
       searchAppeal(){

       },
       allowAppeal(){

       },
       refuseAppeal(){

       }
   }
}
</script>

<style scoped>

</style>
